package cn.lili.controller.statistics;

import cn.lili.common.utils.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.order.order.client.RefundOrderStatisticsClient;
import cn.lili.modules.statistics.entity.dto.StatisticsQueryParam;
import cn.lili.modules.statistics.entity.vo.RefundOrderStatisticsDataVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 退款统计接口
 *
 * @author Bulbasaur
 * @since 2020/12/9 19:04
 */
@Api(tags = "退款统计接口")
@RestController
@RequestMapping("/statistics/refundOrder")
@RequiredArgsConstructor
public class RefundOrderStatisticsController {

    private final RefundOrderStatisticsClient refundOrderStatisticsClient;

    @ApiOperation(value = "获取退款统计列表")
    @GetMapping("/getByPage")
    public ResultMessage<Page<RefundOrderStatisticsDataVO>> getByPage(StatisticsQueryParam statisticsQueryParam) {
        return ResultUtil.data(refundOrderStatisticsClient.getRefundOrderStatisticsData(statisticsQueryParam));
    }

    @ApiOperation(value = "获取退款统计金额")
    @GetMapping("/getPrice")
    public ResultMessage<Object> getPrice(StatisticsQueryParam statisticsQueryParam) {
        return ResultUtil.data(refundOrderStatisticsClient.getRefundOrderStatisticsPrice(statisticsQueryParam));
    }
}
